<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<form action="sboardList.do" name="search" method="get" 
                           onsubmit="return searchCheck()">
	
	<table class="search">
		<tr>
			<td>
				<select name="keyField">
					<option value="title">제목</option>
					<option value="content">내용</option>
					<option value="all">전체</option>
				</select>
			</td>
			<td>
				<input type="text" size="16" name="keyWord">
			</td>
			<td>
				<input type="submit" value="찾기" class="inputb">
			</td>
		</tr>
	</table>
</form>
<table>
	<tr>
		<td class="align-right">
			<input type="button" value="글쓰기" class="inputb"
			                 onclick="location.href='sboardWrite.do'">
		</td>
	</tr>
</table>
<table class="border-style">
	<tr>
		<th>번호</th>
		<th>제목</th>
		<th>글쓴이</th>
		<th>날짜</th>
		
	</tr>
	<c:forEach var="article" items="${list}">
	<tr>
		<td class="align-center">
			${number}
			<c:set var="number" value="${number-1}"/>
		</td>
		<td>
			<a href="detail.do?no=${article.no}">${article.title}</a>
		</td>
		<td>${article.id}</td>
		<td><fmt:formatDate value="${article.regidate}" pattern="yyyy년MM월dd일"/></td>
		<td class="align-center">없엉</td>
	</tr>
	</c:forEach>
	<c:if test="${count == 0}">
	<tr>
		<td colspan="5" class="align-center">등록된 게시물이 없습니다.</td>
	</tr>	
	</c:if>
</table>
<table>
	<c:if test="${count > 0}">
	<tr>
		<td class="align-center">${pagingHtml}</td>
	</tr>
	</c:if>
	<tr>
		<td class="align-right">
			<input type="button" value="글쓰기" class="inputb"
			                 onclick="location.href='sboardWrite.do'">
		</td>
	</tr>
</table>